"""Debug advection solver."""
import sys
import numpy as np
from pathlib import Path

sys.path.insert(0, str(Path(__file__).parent.parent))

from src.reproduct_paper.problems.advection import advection_1d_reference

problem = advection_1d_reference()

# Test exact solution
print("Testing exact solution...")
x = np.array([2.5])
t = np.array([0.0])

# Initial condition
ic = problem["initial_condition"](x)
print(f"IC at x=2.5: {ic}")

# Exact solution at t=0 should match IC
exact_t0 = problem["exact_solution"](x, t)
print(f"Exact at (x=2.5, t=0): {exact_t0}")

# Test at later time
t = np.array([1.0])
exact_t1 = problem["exact_solution"](x, t)
print(f"Exact at (x=2.5, t=1.0): {exact_t1}")

# Test grid evaluation
x_grid = np.linspace(0, 5, 10)
t_grid = np.linspace(0, 2, 5)
u_exact = problem["exact_solution"](x_grid, t_grid)
print(f"\nExact solution shape: {u_exact.shape}")
print(f"Min/max values: {u_exact.min():.3f} / {u_exact.max():.3f}")
